perm filename TEXSEM.DIF[TEX,DEK]2 blob sn#549664 filedate 1980-12-11 generic text, type T, neo UTF8
Lyle, here are the changes to implement \topsep and \botsep. First
come the changes to TEXSEM, which I fortunately kept a copy of:

**** File 1) TEXSEM.SAV[TEX,DEK]/3P/205L
1)	top (1+d) or bottom (d) in its type field, where d = 0 or 2 according as the
1)	insertion is in hmode (non-deferrable) or vmode (deferrable);
1)	define insnode=13 # type code for insertion node;
**** File 2) TEXSEM.SAI[TEX,DEK]/3P/205L
2)	top (1+d) or bottom (d) in its type field, where d = 0 or 2 or 4 according as the
2)	insertion is in hmode (non-deferrable) or vmode (deferrable) or neither
2)	(\topsep or \botsep);
2)	define insnode=13 # type code for insertion node;
***************


**** File 1) TEXSEM.SAV[TEX,DEK]/4P/56L
1)					if type(v) land 2 then print(" (can wait)");
1)					end;
**** File 2) TEXSEM.SAI[TEX,DEK]/4P/56L
2)					if type(v) land 4 then print(" (separator)")
2)					else if type(v) land 2 then print(" (can wait)");
2)					end;
***************


**** File 1) TEXSEM.SAV[TEX,DEK]/6P/39L
1)	integer curbreak # best known place to break on current page;
**** File 2) TEXSEM.SAI[TEX,DEK]/6P/39L
2)	saf boolean array insabsent[0:1] # there is no topins/botins on current page;
2)	integer curbreak # best known place to break on current page;
***************


**** File 1) TEXSEM.SAV[TEX,DEK]/10P/114L
1)	label vloop # go through a vlist;
1)	curbot←temphead; mem[temphead]←0 # botinsert list empty;
1)	curtop←inserts; mem[inserts]←0 # topinsert list empty;
1)	prevp←head; p←mem[head];
**** File 2) TEXSEM.SAI[TEX,DEK]/10P/114L
2)	label vloop,wloop # go through a vlist;
2)	integer separator # pointer to top separator;
2)	curbot←temphead; mem[temphead]←0 # botinsert list empty;
2)	curtop←inserts; mem[inserts]←0 # topinsert list empty;
2)	separator←0;
2)	prevp←head; p←mem[head];
***************


**** File 1) TEXSEM.SAV[TEX,DEK]/10P/122L
1)	while p do
1)		begin
**** File 2) TEXSEM.SAI[TEX,DEK]/10P/124L
2)	wloop: while p do
2)		begin
***************


**** File 1) TEXSEM.SAV[TEX,DEK]/10P/149L
1)			savep←prevp; prevp←curtop;
**** File 2) TEXSEM.SAI[TEX,DEK]/10P/151L
2)			if mem[t] land (4 lsh typed) then
2)				begin comment topsep;
2)				separator←t; p←link(prevp); continue;
2)				end;
2)			savep←prevp; prevp←curtop;
***************


**** File 1) TEXSEM.SAV[TEX,DEK]/10P/167L
1)	mem[prevp]←mem[prevp]+mem[temphead] # this puts in the botinserts;
**** File 2) TEXSEM.SAI[TEX,DEK]/10P/173L
2)	if separator then
2)		begin comment First put the topsep below the topinserts;
2)		savep←prevp; prevp←curtop; mem[prevp]←mem[prevp]+(p←value(separator));
2)		freenode(separator,gluespecsize); separator←0;
2)		go to wloop;
2)		end;
2)	mem[prevp]←mem[prevp]+mem[temphead] # this puts in the botinserts;
***************


**** File 1) TEXSEM.SAV[TEX,DEK]/18P/103L
1)		[topinsend][botinsend] go to topbotinsend;
1)		[justend] begin saveptr←saveptr-3; go to justbox end;
**** File 2) TEXSEM.SAI[TEX,DEK]/18P/103L
2)		[topinsend][botinsend][topsepend][botsepend] go to topbotinsend;
2)		[justend] begin saveptr←saveptr-3; go to justbox end;
***************


**** File 1) TEXSEM.SAV[TEX,DEK]/18P/460L
1)	j←curchar; pushnest; mode←-vmode; prevdepth←pflag;
**** File 2) TEXSEM.SAI[TEX,DEK]/18P/460L
2)	if curchar>1 and mode≠vmode then go to fallthru;
2)	j←curchar; pushnest; mode←-vmode; prevdepth←pflag;
***************


**** File 1) TEXSEM.SAV[TEX,DEK]/19P/181L
1)	a topinsert or botinsert, according to whether -savestack[saveptr]=topinsend or
1)	botinsend, where topinsend=botinsend+1;
1)	begin integer p,q,t;
1)	t←(-savestack[saveptr]-botinsend) lsh typed;
1)	getavail(p);
1)	if t then
1)		begin comment append topskip glue at end of vlist;
1)		q←eqlink(topskip);
1)		mem[p]←(q lsh valued)+(gluenode lsh typed);
1)		mem[curnode]←mem[curnode]+p;
1)		end
1)	else	begin comment insert botskip glue at beginning of vlist;
1)		q←eqlink(botskip);
1)		mem[p]←(q lsh valued)+(gluenode lsh typed)+mem[head];
1)		mem[head]←p;
1)		end;
1)	mem[q]←mem[q]+refct1;
1)	p←vpackage(head,0,false,1);
1)	q←getnode(gluespecsize);
1)	mem[q]←t+ufield(value,mem[p]);
1)	gluespace(q)←height(p)+depth(p);
**** File 2) TEXSEM.SAI[TEX,DEK]/19P/181L
2)	a top/botinsert or top/botsep, according to whether -savestack[saveptr]-botinsend
2)	is 0,1,2,or 3;
2)	begin integer p,q,t;
2)	t←(-savestack[saveptr])-botinsend;
2)	if t≤1 then
2)		begin getavail(p);
2)		if t then
2)			begin comment append topskip glue at end of vlist;
2)			q←eqlink(topskip);
2)			mem[p]←(q lsh valued)+(gluenode lsh typed);
2)			mem[curnode]←mem[curnode]+p;
2)			end
2)		else	begin comment insert botskip glue at beginning of vlist;
2)			q←eqlink(botskip);
2)			mem[p]←(q lsh valued)+(gluenode lsh typed)+mem[head];
2)			mem[head]←p;
2)			end;
2)		mem[q]←mem[q]+refct1;
2)		q←getnode(gluespecsize);
2)		end
2)	else	begin q←separatorspec+4*(t-2); if mem[q] then dsnodelist(value(mem[q]));
2)		end;	
2)	p←vpackage(head,0,false,1);
2)	mem[q]←(t lsh typed)+ufield(value,mem[p]);
2)	gluespace(q)←height(p)+depth(p);
***************


**** File 1) TEXSEM.SAV[TEX,DEK]/19P/205L
1)	getavail(p); mem[p]←(insnode lsh typed)+(q lsh valued);
1)	popnest;
1)	if mode=vmode then
**** File 2) TEXSEM.SAI[TEX,DEK]/19P/209L
2)	popnest;
2)	if t>1 then go to bigswitch;
2)	getavail(p); mem[p]←(insnode lsh typed)+(q lsh valued);
2)	if mode=vmode then
***************


**** File 1) TEXSEM.SAV[TEX,DEK]/19P/229L (when initializing pagesize etc)
1)		end;
**** File 2) TEXSEM.SAI[TEX,DEK]/19P/234L
2)		insabsent[0]←insabsent[1]←true;
2)		end;
***************


**** File 1) TEXSEM.SAV[TEX,DEK]/19P/288L (big case statement in addtopage)
1)	[insnode] begin curins←value(contrib);
1)	if mem[curins] land (2 lsh typed) and pagetail≠pagehead and
**** File 2) TEXSEM.SAI[TEX,DEK]/19P/294L
2)	[insnode] begin integer q; curins←value(contrib);
2)	if mem[curins] land (4 lsh typed) then
2)		begin comment This is a separator node that was cut off a previous page;
2)		q←contrib; contrib←link(q); setlink(q,0); dsnodelist(q);
2)		go to addtopage;
2)		end;
2)	if mem[curins] land (2 lsh typed) and pagetail≠pagehead and
***************


**** File 1) TEXSEM.SAV[TEX,DEK]/19P/295L
1)	pageheight←pageheight+gluespace(curins);
**** File 2) TEXSEM.SAI[TEX,DEK]/19P/306L
2)	q←type(curins) land 1 # 1=top, 0=bot;
2)	if insabsent[q] then
2)		begin insabsent[q]←false;
2)		q←4*q; if mem[separatorspec+q] then
2)			begin comment insert the topsep or botsep;
2)			integer pp,pq,pr; getavail(pp); pq←getnode(gluespecsize);
2)			pr←boxcopy(value(separatorspec+q));
2)			mem[pp]←(insnode lsh typed)+(pq lsh valued);
2)			mem[pq+1]←mem[(separatorspec+1)+q];
2)			mem[pq+2]←mem[(separatorspec+2)+q];
2)			mem[pq+3]←mem[(separatorspec+3)+q];
2)			mem[pq]←((16+q)lsh(typed-2))+(pr lsh valued);
2)			pageheight←pageheight+gluespace(pq);
2)			pagestretch←pagestretch+gluestretch(pq);
2)			pageshrink←pageshrink+glueshrink(pq);
2)			mem[pagetail]←mem[pagetail]+pp; pagetail←pp;
2)			end;
2)		end;
2)	pageheight←pageheight+gluespace(curins);
***************


Next, there are two additions to TEXPRE:
identer("botsep",topbotins,2);
identer("topsep",topbotins,3);

Next, there are changes to TEXSYS, the first two lines of which are
also reflected in TEXHDR:
	just after zeroglue is defined:
internaldef separatorspec=zeroglue+gluespecsize # loc of botsep,topsep specs;
internaldef fontglue=separatorspec+2*gluespecsize # loc of glue for variable spaces;
...
	just after zeroglue is initialized:
	mem[separatorspec]←mem[separatorspec+4]←0 # no topsep,botsep specified yet;

I think that's all I did. However, there was a patch to TEXSYN to correct
another bug. The new code is this (including enough of the environment for
you to figure out where it goes... it's in the macrocall procedure):
		itm←0;
		ngrps←0;
		gettok # set curtok to next input token;
		while curtok≠t do
			begin while curcmd=rbrace do
				begin alignstate←alignstate+1;
				error("Argument of "&escapechar&idname(defplace)&
					" has an extra }");
				gettok;
				end;
			storeitem; itm←curtok;
			if curcmd=lbrace then
				begin comment scan a {} group;